#!/bin/bash

CLASSES_DIR=build/classes

rm -rf build
mkdir -p build

cleanBin() {
  rm -rf $CLASSES_DIR
  mkdir -p $CLASSES_DIR
}

# Create jar for running cross validation set creation
cleanBin
javac src/forecasting/validation/CrossValidationDatasetCreator.java -sourcepath src -d $CLASSES_DIR
jar cvfe build/create_cross_validation_dataset.jar forecasting.validation.CrossValidationDatasetCreator -C $CLASSES_DIR .

# Create jar for joiner
cleanBin
javac src/forecasting/converter/parser/FileJoiner.java -sourcepath src -d $CLASSES_DIR
jar cvfe build/joiner.jar forecasting.converter.parser.FileJoiner -C $CLASSES_DIR .

# Create jar for weka dataset parser
cleanBin
javac src/forecasting/converter/parser/WekaDatasetParser.java -sourcepath src -d $CLASSES_DIR
jar cvfe build/convert_to_weka_dataset.jar forecasting.converter.parser.WekaDatasetParser -C $CLASSES_DIR .

# Create jar for weka dataset parser
cleanBin
javac src/forecasting/util/Driver.java -sourcepath src -d $CLASSES_DIR
jar cvfe build/driver.jar forecasting.util.Driver -C $CLASSES_DIR .

echo 'Cleaning compiled class folder'
rm -rf $CLASSES_DIR
